/*********************************************************************
	filename:	DaterClientSocket.h
	created:	9/4/2012
	author:		Michael Zhang
	
	purpose:	Defines concrete class for Dater client net work.
*********************************************************************/
#ifndef _DaterClientSocket_h_
#define _DaterClientSocket_h_

#include "DaterSocket.h"

#include <string>
#include <queue>

namespace Dater
{
	/*!
	\brief
		An entity class contains 21 year calendars front and back.
	*/
	class ClientSocket : public DaterSocket
	{
	public:
		/*!
		\brief
			Constructor for ClientSocket class.
		*/
		ClientSocket() : _inConnected(false){}
		
		/*!
		\brief
			Destructor for ClientSocket class
		*/
		~ClientSocket(){closesocket(_socket);}
		
		/*!
		\brief
			Get the CalendarYear of the given year

		\param year
			The year of the Calendar.

		\return
			Pointer to the CalendarYear of the given year
		*/
		virtual bool initialSocket(std::string srvAddr);
		
		/*!
		\brief
			a function to determine if connect correctly.
		*/
		bool connectSocket();
		
		/*!
		\brief
			a function to send the string to the server.
		
		\param message
			the message sent to the server.
		*/
		void sendMessage(const std::string& message);
		
		/*!
		\brief
			a function to receive the string.
		*/
		std::string recvMessage();
		
		/*!
		\brief
			a function to start listening.
		*/
		void startListen();

	private:
		ClientSocket(const ClientSocket&);
		bool _inConnected;
	};

}

#endif